<%-- 
 *Workshop 
 *Class ID        : SE0691   
 *Student ID      : SE90009
 *Student Name    : Phạm Nguyễn Nhật Trung
 *Due Date        : Nov 23, 2012, 2:55:44 AM
 *I declare that this assignment is my own work
 *in accordance with FPT Policy.
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <LINK REL=StyleSheet HREF="style\style.css" TYPE="text/css" MEDIA=screen>
        <title>Logout</title>
    </head>
    <body>
        <%
            try {
                Cookie[] ck = request.getCookies();
                if (ck != null) {
                    for (int i = 0; i < ck.length; i++) {
                        if ("userId".equals(ck[i].getName())) { //Finding Username Cookie
                            System.out.println("userId".equals(ck[i].getName()));
                            ck[i].setMaxAge(0); //Delete cookie
                            response.addCookie(ck[i]); //Delete cookie
                            i = ck.length;
                        }
                    }
                }
            } catch (Exception e) {
            }
            response.sendRedirect("login.jsp");
        %>
    </body>
</html>
